import Vue from 'vue'
import App from './App'
import store from './store/index'
import empty from './components/empty/empty.vue'
import uView from "uview-ui";
import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload)
Vue.use(uView);
Vue.config.productionTip = false

App.mpType = 'app'
Vue.component('empty', empty)
Vue.prototype.GetRect = function (selector, all) {
	return new Promise(resolve => {
		let query = null;
		// 支付宝小程序不能加后面的.in(this)，是它自身的限制
		// #ifndef MP-ALIPAY
		query = uni.createSelectorQuery().in(this)
		// #endif
		// #ifdef MP-ALIPAY
		query = uni.createSelectorQuery()
		// #endif
		query[all ? 'selectAll' : 'select'](selector)
			.boundingClientRect(rect => {
				if (all && Array.isArray(rect) && rect.length) {
					resolve(rect)
				}
				if (!all && rect) {
					resolve(rect)
				}
			})
			.exec()
	})
}
// 判断市场常见的几种刘海屏机型
uni.getSystemInfo({
	success: function (res) {
		let modelmes = res.model;
		console.log("手机型号-------", res.system + res.model);
		window.localStorage.setItem('os', res.system + res.model)


		if (modelmes.indexOf('iPhone X') >= 0 || modelmes.indexOf('iPhone XR') >= 0 || modelmes.indexOf('iPhone XS') >= 0 || modelmes.indexOf('iPhone 12') >= 0 || modelmes.indexOf('iPhone 11') >= 0 || modelmes.indexOf('iPhone11') >= 0 || modelmes.indexOf('iPhone12') >= 0 || modelmes.indexOf('iPhoneXR') >= 0 || modelmes.indexOf('iPhoneX') >= 0) {
			Vue.prototype.$is_bang = true
		} else {
			Vue.prototype.$is_bang = false
		}
	}
});
// Vue.prototype.$store = store;
const app = new Vue({
	...App,
	store
})
app.$mount()